package models

import (
	"gorm.io/gorm"
	"server/basic/config"
	"time"
)

type Consultation struct {
	Id          uint           `gorm:"column:id;type:bigint UNSIGNED;primaryKey;not null;" json:"id"`
	UserId      uint           `gorm:"column:user_id;type:bigint UNSIGNED;not null;default:0;" json:"user_id"`
	DoctorId    uint           `gorm:"column:doctor_id;type:bigint UNSIGNED;not null;default:0;" json:"doctor_id"`
	UserSymptom string         `gorm:"column:user_symptom;type:varchar(255);not null;" json:"user_symptom"`
	CreatedAt   time.Time      `gorm:"column:created_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"created_at"`
	UpdatedAt   time.Time      `gorm:"column:updated_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"updated_at"`
	DeletedAt   gorm.DeletedAt `gorm:"column:deleted_at;type:datetime(3);default:NULL;" json:"deleted_at"`
}

func (c *Consultation) TableName() string {
	return "consultation"
}
func (c *Consultation) CreateConsultation() error {
	return config.DB.Create(&c).Error
}
